package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.User;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.query.UserQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper {

    int insert(User record);

    User selectByPrimaryKey(Long id);

    User selectByEmailAndPassword(@Param("email") String email, @Param("password") String password);

    List<User> selectAll(UserQuery qo);

    /**
     * 查询所有的id, 插入系统消息的时候需要使用
     * @return id 列表
     */
    List<User> selectAllUser();

    int updateByPrimaryKey(User record);

    List<User> queryForList(QueryObject qo);

    void insertUserAndFollowRelation(@Param("userId") Long userId, @Param("followId") Long followId);
    //查询关注表的关系
    Integer selectRelationsByUserIdAndFollowID(@Param("userId") Long userId, @Param("followId") Long followId);

    void deleteRelation(@Param("followId") Long followId);

    int getFansByUserId(Long userId);

    int getFollowsByFollowId(Long followId);

    List listTravelersById(Long userId);
}